﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Lamex.Library;
using Lamex.Interface;
using Lamex.Library.CommonClass;
using Lamex.Common;
using Lamex.mIE.UI;
using Lamex.SIESystemManager;
using Lamex.SIESystemManager.UI;

namespace Lamex.mIE.UI
{
    public partial class frmIE_Main : frmModuleBase
    {
        public frmIE_Main()
        {
            InitializeComponent();
            menuStrip1.Text = ModuleNames.mIE; //与AssemblyModuleEntry.ModuleName定义相同
        }
        public override MenuStrip GetModuleMenu()
        {
            return this.menuStrip1;
        }

    #region IE+标准窗体集，参数：窗体名称 ｜ 0-无失效时间;1-有失效时间 | true-可编辑;false-仅查询 | true-默认刷新;false-用户刷新
        //无关联表
        private void menuIE_MasterData_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_MasterData", 0, false, false), sender as ToolStripMenuItem);
        }
        //单表单字段关联
        private void menuIE_wkCenter_ScheduleFactor_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_WorkCenter_ScheduleFactor", 1, true, true), sender as ToolStripMenuItem);
        }
        //多表多字段关联
        private void menuIE_PartCyleTime_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_CycleTime", 0, true, false), sender as ToolStripMenuItem);
        }

        private void menuIE_wkCenter_Definition_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_WorkCenter_Definition", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_wkCenter_CostFactor_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_WorkCenter_CostFactor", 1, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_wkCenter_AllowanceFactor_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_WorkCenter_AllowanceFactor", 1, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_Feat_Definition_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Feature_Definatian", 1, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_Feat_ValueOption_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Feature_ValueOption", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_Feat_CalLogicType_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Feature_CalculateLogic", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_RoutingCombination_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Routing_Combination", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_ProcessFeature_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_WorkCenter_Feature", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_Feat_ProdClassify_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Feature_ValueOption_Labor", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_Ass_FeatMatMaintain_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_BOM_Comp_MatCheck", 0, true, true), sender as ToolStripMenuItem);
        }

        private void menuIE_AssemblyAndPacking_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_BOM_Comp_MatCheck", 0, true, true), sender as ToolStripMenuItem);
        }

    #endregion

    #region IE+定制窗体集

        private void menuIE_TaskList_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_TaskList), sender as ToolStripMenuItem);
            //(MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_TaskList), sender as ToolStripMenuItem) as Frm_IE_Part_TaskList).DoView(null);
            // MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_TaskList", 0), sender as ToolStripMenuItem);
            Frm_IE_Part_TaskList form = new Frm_IE_Part_TaskList(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_TaskList");
            form.DoView(null);
        }

        private void menuIE_Routing_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Routing_Part), sender as ToolStripMenuItem);
            Frm_IE_Routing_Part form = new Frm_IE_Routing_Part(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_Routing");
        }

        private void menuIE_PartFeature_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_PartFeature), sender as ToolStripMenuItem);
            Frm_IE_PartFeature form = new Frm_IE_PartFeature(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_PartFeature");
        }

        private void menuIE_SizePar_Laminate_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_SizeParmList_Excel), sender as ToolStripMenuItem);
            Frm_IE_Part_SizeParmList_Excel form = new Frm_IE_Part_SizeParmList_Excel(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_SizePar_Laminate");
        }

        private void menuIE_SizePar_Panel_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_SizeParmList_Excel), sender as ToolStripMenuItem);
            Frm_IE_Part_SizeParmList_Excel form = new Frm_IE_Part_SizeParmList_Excel(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_SizePar_Panel");
        }

        private void menuIE_SizePar_MCG_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_SizeParmList_Excel), sender as ToolStripMenuItem);
            Frm_IE_Part_SizeParmList_Excel form = new Frm_IE_Part_SizeParmList_Excel(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_SizePar_MCG");
        }

        private void menuIE_SizePar_SeatingFabric_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_SizeParmList_Fabric), sender as ToolStripMenuItem);
        }

        private void menuIE_SizePar_SeatingFoam_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Part_SizeParmList_Foam), sender as ToolStripMenuItem);
        }

        private void menuIE_LaborDataUpload_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_LaborDataUpload), sender as ToolStripMenuItem);
            Frm_IE_LaborDataUpload form = new Frm_IE_LaborDataUpload(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_LaborDataUpload");
        }

    #endregion

    #region IED模块，临时由挂接到IE+，后期安排全部转入IE+

        private void menuIE_LmtFeat_STD_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEOperationData), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtFeat_SJR_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEOperationDataSJ), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtFeat_ASS_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEGroupPackageData), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtHour_STD_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEWorkHoursCalculate), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtHour_SJR_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEWorkHoursBack), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtHour_ASS_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEBOMWorkHoursBack), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtData_Allowance_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEAllowanceFactor), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtData_ActionList_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEOperationalDefinition), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtData_ProcessAction_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEProcessOperation), sender as ToolStripMenuItem);
        }

        private void menuIE_LmtData_MachineTime_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmBIEMachineHours), sender as ToolStripMenuItem);
        }

    #endregion

    #region 其他

        private void menuIE_Lay_Overall_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmIE_Layout_Lamex), sender as ToolStripMenuItem);
        }

        private void menuIE_ExpressionCal_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_PartInterFace), sender as ToolStripMenuItem);
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmIE_Formula_Check), sender as ToolStripMenuItem);       
        }

        private void pnlContainer_Paint(object sender, PaintEventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_PartInterFace), sender as ToolStripMenuItem);
        }

        private void 测试ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(FrmMESProject), sender as ToolStripMenuItem);
        }

    #endregion

        private void menuIE_SizePar_SeatingBatch_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Reference_Add), sender as ToolStripMenuItem);
        }

        private void menuIE_Query_By_MaterialNo_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("View_IE_Labor_Time_By_PartNo", 1, false, false), sender as ToolStripMenuItem);
        }

        private void menuIE_Query_By_Workcenter_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("View_IE_Labor_Time_By_Process", 1, false, false), sender as ToolStripMenuItem);      
        }

        private void menuIE_Query_By_Feature_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_FeatureList", 1, false, false), sender as ToolStripMenuItem);
        }

        private void menuIE_LaborDeleteLockFlag_Click(object sender, EventArgs e)
        {
            //MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Batch_UnLockTask), sender as ToolStripMenuItem);
            Frm_IE_Batch_UnLockTask form = new Frm_IE_Batch_UnLockTask(Lamex.Library.CommonClass.BuildSqlHelper.GetProcType());
            MdiTools.OpenChildForm_Param(this.MdiParent as IMdiForm, form, "menuIE_LaborDeleteLockFlag");
        }

        private void menuIE_LaborAddEnableFlag_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(Frm_IE_Dwg_LockTask), sender as ToolStripMenuItem);
        }

        private void menuIE_Query_Size_Fabric_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_SizeParmList_Fabric", 1, false, false), sender as ToolStripMenuItem);
        }

        private void menuIE_Query_Size_Foam_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_SizeParmList_Foam", 1, false, false), sender as ToolStripMenuItem);
        }

        private void menuIE_Query_Size_Parameter_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_SizeParmList", 1, false, false), sender as ToolStripMenuItem);
        }

        private void menuIE_Query_TaskData_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_TaskList", 1, false, false), sender as ToolStripMenuItem);
        }

        private void menuIE_Standard_Hour_Filling_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("View_OP_Hour_Missing_List_Union", 0, false, true), sender as ToolStripMenuItem);
        }

        private void menuIE_HPL430_CutSize_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_PN_Basic_Cutting_Data", 0, false, true), sender as ToolStripMenuItem);
        }

        private void menuIE_Revise_Task_List_Data_Click(object sender, EventArgs e)
        {
            //需开发严格管控专用窗体（模块）进行，此标准窗体仅适用于仅有任务清单数据，未进行任何其他流程操作
            //MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_TaskList", 0, true, false), sender as ToolStripMenuItem);
        }

        private void menuIE_Menu_Evolvement_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmIE_Plus_Memu_Structure), sender as ToolStripMenuItem);
        }

        private void menuIE_NotNeedFilling_Click(object sender, EventArgs e)
        {
            MdiTools.OpenChildWebBrowse(this.MdiParent as IMdiForm, new frmBaseChildWinForm("IE_Part_Exclude_List", 0, true, false), sender as ToolStripMenuItem);
        }
    }
}